import { PhotoModel } from '@/database/models/photo.model';
import { PhotoStatus } from '@/enums/photoEnums'
import type { CreateNewPhotoPrams } from './types/image.types';

export class PhotoService {
  static async createNewPhoto(params: CreateNewPhotoPrams) {
    const image = new PhotoModel(params);
    const result = await image.save();
    return result.toObject();
  }

  static delPhoto = async (photoId: string) => {
    const result = await PhotoModel.updateOne(
      { _id: photoId },
      {
        $set: {
          status: PhotoStatus.deleted
        }
      }
    )
    return result;
  }
}